﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            DavidBleinList<int> n = new DavidBleinList<int>(); /// 1 2 3
            Stopwatch sw = new Stopwatch();
            sw.Restart();
            for (int i = 0; i < 1000000; i++)
            {
                n.Add(Convert.ToInt32(DateTime.Now));
            }
            sw.Stop();
            List<int> array = new List<int>();
            Stopwatch sw1 = new Stopwatch();
            sw1.Restart();
            for (int j = 0; j < 1000000; j++)
            {
                array.Add(Convert.ToInt32(DateTime.Now));
            }
            sw1.Stop();
            if (sw.ElapsedMilliseconds < sw1.ElapsedMilliseconds)
            {
                Console.WriteLine(sw.ElapsedMilliseconds + " < " + sw1.ElapsedMilliseconds);
            }
            else if (sw.ElapsedMilliseconds == sw1.ElapsedMilliseconds)
            {
                Console.WriteLine(sw.ElapsedMilliseconds + " = " + sw1.ElapsedMilliseconds);
            }
            else if (sw.ElapsedMilliseconds > sw1.ElapsedMilliseconds)
            {
                Console.WriteLine(sw.ElapsedMilliseconds + " > " + sw1.ElapsedMilliseconds);
            }
            Console.ReadLine();
        }
    }
     public   class DavidBleinList<TElement>
    {
       public DavidBleinListItem first;
       public DavidBleinListItem last;
        public int item;
       
             DavidBleinListItem newItem = new DavidBleinListItem();

        public void Add(TElement a)// Add(5)
        {
            var n = new DavidBleinListItem();
            n.data = Convert.ToInt32(a);

            if (first == null)
            {
                first = n;
                last = n;
            }
            else
            {

                last.next = n;
                last = n;
            }
        }
       public int this[int index]
     {
         get
         {
             newItem = first;
             for (int i = 0; i < index; i++)
             {
                 
                 newItem = newItem.next;
             }
             return newItem.data;
         }
     }
           
        public void Remove(int b)
        {
            
             newItem = first;
             for (int i = 0; i < b -1; i++)
             {

                 newItem = newItem.next;
             }
             newItem.next = newItem.next.next;
        }
    }
   public  class DavidBleinListItem
    {
         public  DavidBleinListItem next;
         public int data;
    }
}
